{extend name="base" /}
{block name="css"}
<link rel="stylesheet" href="/static/wechat/menu/css/wx_menu.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/font-awesome/4.6.0/css/font-awesome.min.css"/>
{/block}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        
        <div class="fluid">
            <!---->
            <div class="layui-row">
                <div class="layui-col-md4">
                    <div class="layui-btn-group" style="padding-left: 0px;">
                        <a href="{:url('add',['pid'=>'0'])}" class="layui-btn ajax-iframe" data-width="740px" data-height="500px"><i class="fa fa-plus-circle"></i> 新增菜单</a>
                        <a href="{:url('get_menu')}" class="layui-btn layui-btn-normal ajax-action"><i class="fa fa-check-square"></i> 获取菜单</a>
                        <a href="{:url('send_menu')}" class="layui-btn layui-btn-normal ajax-action"><i class="fa fa-send"></i> 发布菜单</a>
                    </div>
                    <!---->
                    <div class="pannel">
                        <div class="wx-card">
                            <div class="wx-box">
                                <div class="wx-head">微信公众号</div>
                                <div class="wx-body">
                                    <p class="content-tips">内容区域</p>
                                    <div class="wx-footer">
                                        <li class="add-menu"><i class="fa fa-plus"></i></li>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                    <!---->
                </div>
                <div class="layui-col-md8">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th>菜单名称</th>
                                <th>类型</th>
                                <th>排序</th>
                                <th style="width:150px;">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach name="list" item="v"}
                            <tr>
                                <td>
                                    {if $v.pid == '0'}
                                    {$v.name}
                                    <a class="layui-btn layui-btn-xs layui-bg-green ajax-iframe" href="{:url('add',['pid'=>$v.id])}" data-width="740px" data-height="420px"> 新增子菜单</a>
                                    {else}
                                    〉〉{$v.name}
                                    {/if}
                                </td>
                                <td>
                                    {if $v.type == 'text'}
                                    <button class="layui-btn layui-btn-xs layui-bg-red">文本消息</button>
                                    {elseif $v.type == 'img'}
                                    <button class="layui-btn layui-btn-xs layui-bg-orange">图片消息</button>
                                    {elseif $v.type == 'click'}
                                    <button class="layui-btn layui-btn-xs layui-bg-green">发送消息</button>
                                    {elseif $v.type == 'voice'}
                                    <button class="layui-btn layui-btn-xs layui-bg-cyan">语音消息</button>
                                    {elseif $v.type == 'video'}
                                    <button class="layui-btn layui-btn-xs layui-bg-black">视频消息</button>
                                    {elseif $v.type == 'view'}
                                    <button class="layui-btn layui-btn-xs layui-bg-blue">跳转链接</button>
                                    {elseif $v.type == 'miniprogram'}
                                    <button class="layui-btn layui-btn-xs layui-bg-gray">小程序跳转</button>
                                    {elseif $v.type == 'news'}
                                    <button class="layui-btn layui-btn-xs layui-bg-black">图文列表</button>
                                    {else}
                                    
                                    {/if}
                                </td>
                                <td>
                                    <input type="text" name="sort_order" value="{$v.sort_order}" autocomplete="off" class="layui-input ajax-update" data-url="{:url('wechat/menu/edit', ['id' => $v.id,'pid'=>$v.pid])}">
                                </td>
                                
                                <td>
                                    <a href="{:url('wechat/menu/edit', ['id' => $v.id,'pid'=>$v.pid])}" class="layui-btn layui-btn-xs layui-btn-normal ajax-iframe" data-width="740px" data-height="420px"><i class="fa fa-edit"></i> 编辑</a>
                                    <a href="{:url('wechat/menu/del', ['id' => $v.id,'pid'=>$v.pid])}" class="layui-btn layui-btn-xs layui-btn-danger ajax-delete"><i class="fa fa-trash-o"></i> 删除</a>
                                </td>
                            </tr>
                            {/foreach}
                        </tbody>
                    </table>
                </div>
            </div>
            
        </div>
    </div>
</div>

{/block}
{block name="js"}
    <script src="/static/wechat/menu/js/wx_menu.js"></script>
    <script>
        setMenuList({:json_encode($menu)});
    </script>
{/block}
